/*
 * Created by: 	Zhaoningbo
 * at:			2011-8-30 - 下午01:29:54
 * blog:		(http://zhaoningbo.iteye.com/)
 */
package com.gc.test.exception;

import java.io.Serializable;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.gc.action.exception.LogicUnImpl;

public class MyTestLogicAOPUnImpl implements Serializable {

    private static final long serialVersionUID = 3615769411502898895L;

    public static void main(String[] args) {
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext(
                "classpath:exception_config.xml");
        /*
         * "Spring 从入门到精通"一个错误的例子。 Exception in thread "main"
         * java.lang.ClassCastException: $Proxy1 cannot be cast to
         * com.gc.action.exception.LogicUnImpl at
         * com.gc.test.exception.MyTestLogicAOPUnImpl
         * .main(MyTestLogicAOPUnImpl.java:23)
         * 
         * Because: AOP, only used in the Interface! And Cannot be a object.
         */
        LogicUnImpl logicUnImpl = (LogicUnImpl) applicationContext
                .getBean("logicUnImpl");

        logicUnImpl.insert("红");
        logicUnImpl.update("十");
        logicUnImpl.delete("字");

    }

}
